package com.briup.day16;

import java.io.*;

/**
 * @author 谭梦寻
 * @version 1.1
 * 实现java对象的序列化和反序列化
 */
public class TestTransient {
    public static void main(String[] args) throws IOException, ClassNotFoundException {
//        1 声明两个流 序列化 反序列化
        ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream("d.txt"));
        ObjectInputStream ois = new ObjectInputStream(new FileInputStream("d.txt"));
        Student jack = new Student(1, "jack","昆山");
        oos.writeObject(jack);
        oos.flush();
        oos.close();
//        读操作
        Object o = ois.readObject();
        System.out.println(o);

    }
}
